import java.util.Arrays;

public class newArrays {
    public static void main(String[] args) {
        int oldArr[] = {1, 3, 4, 5, 0, 0, 6, 6, 0, 5, 4, 7, 6, 7, 0, 5};
        int count = 0;
        for (int i = 0; i < oldArr.length; i++) {
            if (oldArr[i] == 0) {
                count++;
            }
        }
        int[] newoldArr = new int[oldArr.length - count];
        System.out.println(newoldArr.length);
        int index = 0;//控制新数组下标
        //1, 3, 4, 5, 0, 0, 6, 6, 0, 5, 4, 7, 6, 7, 0, 5
        for (int i = 0; i < oldArr.length; i++) {
            if (oldArr[i] != 0) {
                newoldArr[index] = oldArr[i];
                index++;
            }
        }
        System.out.println(newoldArr.length);
        System.out.println(Arrays.toString(newoldArr));
//        for (int i = 0; i <newaldArr.length ; i++) {
//            if (newaldArr[i]>0){
//                System.out.print(newaldArr[i]);
//            }else {
//            }
//        }
    }
}
